package src.main.dailimoshi.dongtaidaili;

import src.main.dailimoshi.jingtaidaili.Goods;
import src.main.dailimoshi.jingtaidaili.GoodsProducer;
import src.main.dailimoshi.jingtaidaili.ProxySale;

/**消费者*/
public class TestConsumer {
    public static void main(String[] args) {
        //静态
//        ProxySale proxySale=new ProxySale();
//        proxySale.goods();

        //动态
        GoodsProducer goodsProducer=new GoodsProducer();//被代理对象
        DynamicProxySale dynamicProxySale=new DynamicProxySale();//动态代理对象
        dynamicProxySale.setObject(goodsProducer);//将被代理对象传入动态代理对象
        //生成最终的代理对象
        Goods goods=(Goods)dynamicProxySale.getProxySale();//根据传入被代理对象动态生成的最后代理对象
        goods.goods();
    }
}
